Instructions
-- List backup content
Restore filelistonly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121115_log.bak'
-- Restore headeronly searches all backup headers of all backup sets on a specific backup device. The result of executing restore headeronly is a result set.
Restore headeronly from disk = 'C: \ northwind \ 2012_46 \ northwind_20121116_155022_full.bak'
-- Restore labelonly returns a result set consisting of inform
Tags: style from LIS SQL statement modify member Bak level backupWhen you use a statement to restore a database, the following error is reported: Msg 3234, Level 16, State 2, line 29thThe logical file ' lenbormealorder_base_2017 ' is not part of the database ' members_01 '. Please use RESTORE filelistonly to list the logical file names.Msg 3013, Level 16, State 1, line 29thRESTORE DATABASE is terminating abnormally. Cause: This database was backed up
' Northwind ' to ' D:/microsoft SQL Server/mssql.1/ms Sql/data/northwind.mdf ' , move ' northwind_log ' to ' D:/microsoft SQL Server/mssql.1/mssql/data/northwind.ldf 'The Northwind database is restored successfully in SQL Server 2005.Note that when you restore Northwind in SQL Server 2005, you do not need to first create a Northwind database with the same name, but restore directly.Another problem is if the customer gives you a Northwind.bak backup file that lets you restore on your own
:/northwind.bak ' with
move ' Northwind ' to ' D:/microsoft SQL Server/mssql .1/mssql/data/northwind.mdf '
, move ' northwind_log ' to ' D:/microsoft SQL Server/mssql.1/mssql/data/northwind.ldf ‘
The Northwind database is restored successfully in SQL Server 2005. Note that when you restore Northwind in SQL Server 2005, you do not need to first create a Northwind database with the same name, but restore directly. Another problem is if the customer gives you a Northwind.bak backup file th
with the with format parameter for a full rewriteBACKUP DATABASE realdb to DISK = ' E:\db\BAK_FOR_realdb.bak ' with FORMAT--Use the RESTORE filelistonly command to view the contents of the database backup file--Logical name of the data file and log file for the next commandRESTORE filelistonly from DISK = ' E:\db\BAK_FOR_realdb.bak '
--Create a new database using the backup file, Realdb_dat and Real
Label:RESTORE filelistonly from DISK = ' E:\bbs8.1\Dvbbs8.1.0_SQL\Data\sq_ebendegfzds_bkp_1.bak ' Go The above text lists the logical name (LogicalName) of the. bak file that you want to restore. The logical names of the. mdf and. LDF in this example are "Sq_ebende_data" and "Sq_ebende_log", respectively, with logical names to restore the database The statement is: Restore Database name From disk= ' backup file path ' With Move '. mdf file logical fil
Here I assume the server a,b,c
A is the principal server, B is the mirror server, and C is the witness server
A Server
Use master
Go
Restore filelistonly from disk=n ' F:\databak\ccerp_jzt_backup_200911250100.bak '
Restore database Ccerp_jzt from disk=n ' F:\databak\ccerp_jzt_backup_200911250100.bak ' with Replace,recovery,
Move ' ccerp_ydswzip_data ' to ' d:\data\ccerp_jzt.mdf ',
Move ' ccerp_ydswzip_log ' to ' d:\data\ccerp_jzt_log.ldf '
exec sp_h
to physical file name" to the file name you want your data file to hold
--select "Force Restore on existing database" if the database to be restored already exists-
-Determine
2. Use the SQL statement method (assuming your backup file name is: C:/xx.bak
--Lists the logical file names in the backup file
Restore filelistonly from disk= ' C:/xx.bak '
--Use the MOVE option with the statement recovery, based on the logical file name listed above
Rest
matter which backup file you want to query can be queried
The code is as follows:
RESTORE FileListOnly From Disk = 'C: \ Temp2_FullBackup_Partial1_2014_12_19_150533.bak 'RESTORE FileListOnly From Disk = 'd: \ comment 'restore HeaderOnly From Disk = 'C: \ Temp2_FullBackup_Partial1_2014_12_19_150533.bak 'restore HeaderOnly From Disk = 'd: \ Temp2_FullBackup_Partial2_2014_12_19_150533.bak'
Restore
The cod
Code is as follows:RESTORE FileListOnly From Disk = 'C: \ Temp2_FullBackup_Partial1_2014_12_19_150533.bak 'RESTORE FileListOnly From Disk = 'd: \ comment 'Restore HeaderOnly From Disk = 'C: \ Temp2_FullBackup_Partial1_2014_12_19_150533.bak 'Restore HeaderOnly From Disk = 'd: \ Temp2_FullBackup_Partial2_2014_12_19_150533.bak'
Restore
Copy codeThe Code is as follows:USE [master] restore database [Temp2] fro
The following error occurs during manual recovery:
The backup set holds a backup of a database other than the existing database. Restore database is terminating abnormally
Use force reply. From the swlicense. Bak file, restore the data and table structure to a new database swlicmanitenance.
Restore filelistonly from disk = 'd: \ panshengbo \ swlicense. Bak'
Restore database swlicmaintenance from disk = 'd: \ panshengbo \ swlicense. Bak'With
Database recovery can be achieved by using a new name, which often meets the needs of the business. When you use a different name to restore the database, you will have to set up a new location for each file in the database. If you have not previously known what files are in the database, you can run the RESTORE FILELISTONLY declaration to obtain the number and name of the database files. Running restore FILELISTO
Tags: style color os using file data problem div spWhen the normal restore error:Microsoft SQL-DMO(ODBC sqlstate:42000)---------------------------When trying to enlarge a physical file,MODIFY FILE experienced operating system error 112 ( There is not enough disk space.) Failed to create one or more files. Please consider using withmove option to identify a valid location. Restoredatabase The operation terminated abnormally. /span> but hard disk space is enough! -----------------
The disk space of the restored database file is insufficient.
You can use the following statement to query the number of files in the restored database, and the size of these files. After restoration, the files will be placed on that disk.
Restore filelistonly from disk = 'C: \ backup file name. Bak'
If you want to put the data file on another disk with enough space, use the move option to change the location of the restored file.
Restore database
(200) SET @ CurrentTime = REPLACE (CONVERT (VARCHAR, GETDATE (), 120), '-', '_'), ',' _ '),': ',') -- (full backup of Temp2 database) SET @ FileName = 'C: \ Temp2_FullBackup_Partial1 _ '+ @ CurrentTime + '. bak 'set @ FileName2 = 'd: \ temp2_fullbackup_partial _ '+ @ CurrentTime + '. bak 'backup DATABASE [Temp2] to disk = @ FileName, DISK = @ FileName2WITH FORMAT
Drive C
Disk D
We can see that the size of each backup file is average, which is 16 MB. If it is divided into three backup
An error is reported during normal restoration:
Microsoft SQL-DMO (ODBC sqlstate: 42000)
---------------------------
When trying to expand the physical file, modify file encountered an operating system error of 112 (insufficient disk space .).
One or more files cannot be created. Use the with move option to identify a valid location.
The Restore database operation is terminated abnormally.
However, the hard disk space is sufficient!
Solution:
If the disk space of the restored database
Here we assume that the server A, B, and C
A is the master server, B is the backup server, and C is the witness server.
Server
Use master
Go
Restore filelistonly from disk = n'f: \ databak \ ccerp_jzt_backup_200911250100.bak'
Restore database ccerp_jzt from disk = n' F: \ databak \ ccerp_jzt_backup_200911250100.bak 'with replace, recovery,
Move 'ccerp _ ydswzip_data 'to 'd: \ data \ ccerp_jzt.mdf ',
Move 'ccerp _ ydswzip_log 'to 'd: \ data \ ccerp_j
backup files? The method is simple.
Just to Backup to C disk, now we back up to C and D disk
Copy Code code as follows:
DECLARE @CurrentTime VARCHAR (m), @FileName VARCHAR, @FileName2 VARCHAR SET @CurrentTime = replace (replace ( REPLACE (CONVERT (VARCHAR, GETDATE (), (), '-', ' _ '), ', ' _ '), ': ', '--(TEMP2 Database full backup) SET @FileName = ' C:\Temp2_Full Backup_partial1_ ' + @CurrentTime + '. Bak ' SET @FileName2 = ' D:\Temp2_FullBackup_Partial2_ ' + @CurrentTime + '
Server certificates and asymmetric keys.
Steps:
Optionally, execute the RESTORE filelistonly statement to determine the number and name of the files in the full database backup.
Executing the RESTORE DATABASE statement restores a full backup of the databases while specifying:
The name of the database to restore.
The backup device from which to restore the full database backup.
Specify a move clause for each file you want to revert to the new location
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.